package com.code.soulqlexpress.func;

import com.ql.util.express.Operator;
import com.ql.util.express.OperatorOfNumber;

/**
 * @author songyang
 * @date 2022/4/21
 */
public class DivOperator extends Operator {
    @Override
    public Object executeInner(Object[] list) throws Exception {
        String msg;
        if (list[0] == null || list[1] == null || list[1].equals(0)) {
            return Boolean.FALSE;
        } else if (!(list[0] instanceof Number) || !(list[1] instanceof Number)) {
            msg = "对象类型不匹配，只有数字类型才才能执行 <= 操作,当前数据类型是:";
            throw new Exception(msg + list[0].getClass().getName() + "," + list[1].getClass().getName());
        } else {
            return OperatorOfNumber.divide(list[0], list[1], this.isPrecise);
        }


    }

}
